<?php
function getCharacters($id){//Recebe listagem de Personagens do usuário.
$query="SELECT 
			character.idCharacter, 
			character.name AS charName,
			user.name AS userName,
			status.name AS status,
			chronicle.name AS chronicle,
			supplement.name AS supplement,
			supplement.description AS supDesc
		FROM 
		`character`,user,status,chronicle,supplement 
		WHERE 
				user.idUser 			= character.idUser
			AND status.idStatus 		= character.idStatus 
			AND chronicle.idChronicle 	= character.idChronicle
			AND chronicle.idSupplement 	= supplement.idSupplement
			AND user.idUser 			='$id'
		ORDER BY status
		LIMIT 0 , 30";
$result = mysql_query($query) or die(mysql_error());
$numRows = mysql_num_rows($result);
if($numRows > 0){
	$cont = 0; 
	$arr_table_result=mysql_fetch_full_result_array($result);
	echo"<table>";
	echo"<tr><th>Status</th><th>Nome</th><th>Cr&ocirc;nica</th><th>Suplemento</th><th>A&ccedil;&otilde;es</th></tr>";
	while($cont<$numRows){
			$charName 		= 	$arr_table_result[$cont]['charName'];
			$status			=	$arr_table_result[$cont]['status'];
			$chronicle		=	$arr_table_result[$cont]['chronicle'];
			$supplement		=	$arr_table_result[$cont]['supplement'];
			$supDesc		=	$arr_table_result[$cont]['supDesc'];
			echo("<tr class=");
			if(($cont % 2)!=0){echo("rowimpar");}else{echo("rowpar");}
			echo("><td>$status</td><td>$charName</td><td>$chronicle</td><td><dfn title='$supDesc'>$supplement</dfn></td><td><a href='#'><img class='icon' alt='Visualizar' title='Ver' src='/img/icons/page_go.png' /></a>&nbsp;<a href='#'><img class='icon' alt='Edit' title='Editar' src='/img/icons/page_edit.png' /></a>&nbsp;<a href='#'><img alt='Delete' class='icon' title='Deletar'  src='/img/icons/cross.png' /></a></td></tr>");
		$cont++;
		}
	echo"</table>";
}else{
	echo"Voc&ecirc; n&atilde;o possui nenhum personagem cadastrado.";
}
}
?>